#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from tortoise import fields

from app.base.base_model import (
    BaseModel, BaseCreatedUpdatedModel
)
from app.admin.enums import MenuType

class Menu(BaseModel, BaseCreatedUpdatedModel):
    menu_name   = fields.CharField(max_length=30, description="菜单名称")
    remark      = fields.CharField(max_length=500, null=True, description="保留字段", blank=True)
    menu_type   = fields.CharEnumField(MenuType, null=True, blank=True, description="菜单类型")
    icon        = fields.CharField(max_length=100, null=True, blank=True, description="菜单图标")
    path        = fields.CharField(max_length=100, description="菜单路径")
    order       = fields.IntField(default=0, description="排序")
    parent_id   = fields.IntField(default=0, max_length=10, description="父菜单ID")
    hidden      = fields.BooleanField(default=False, description="是否隐藏")
    component   = fields.CharField(max_length=100, description="组件")
    keepalive   = fields.BooleanField(default=True, description="存活")
    redirect    = fields.CharField(max_length=100, null=True, blank=True, description="重定向")
    removable   = fields.BooleanField(default=True, description="是否可删除")
    hiddenable  = fields.BooleanField(default=True, description="是否可隐藏")
    
    class Meta:
        table = "menu"